package org.rcy.framework.thrift.metadata;

import org.apache.thrift.protocol.TType;
import org.rcy.framework.thrift.ReflectionUtils;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public class StructMetaData extends FieldValueMetaData {
	
	private static final long serialVersionUID = 1L;
	
	public final Class<?> structClass;
	public Type[] typeArguments;//实体中的泛型参数

	public StructMetaData(Type javaType) {
		super(TType.STRUCT, javaType);
		this.structClass = ReflectionUtils.resolveType(javaType);
		if (javaType instanceof ParameterizedType) {
			this.typeArguments = ((ParameterizedType)javaType).getActualTypeArguments();
		}
	}

	public Type[] getTypeArguments() {
		return typeArguments;
	}
}
